package me.chenjp.tracker.core.exception;

import lombok.Data;
import me.chenjp.tracker.core.bean.State;

/**
 * Created by gaopq on 2017/10/26.
 * Description:
 */
@Data
public class BaseServiceException extends Exception {
    private Integer errorCode;
    private String message;
    private State state;

    public BaseServiceException(Integer errorCode, String message) {
        this.errorCode = errorCode;
        this.message = message;
    }

    public BaseServiceException() {
    }

    public BaseServiceException(String message, Throwable cause) {
        super(message, cause);
    }

    public BaseServiceException(State state) {
        this.state = state;
        this.errorCode = state.getCode();
        this.message = state.getMsg();
    }

}
